<template>
  <div>
    <el-table :data="tableData">
      <el-table-column width="50" label="编号" prop="no"></el-table-column>
      <el-table-column width="120" label="收货人" prop="buyerName"></el-table-column>
      <el-table-column width="300" label="收货地址" prop="buyerAddress"></el-table-column>
      <el-table-column width="150" label="手机号码" prop="buyerPhone"></el-table-column>
      <el-table-column width="80" label="支付" prop="payStatus">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.payStatus == '已支付'" type="success" effect="dark">已支付</el-tag>
          <el-tag v-if="scope.row.payStatus == '未支付'" type="danger" effect="dark">未支付</el-tag>
        </template>
      </el-table-column>
      <el-table-column width="180" label="发货时间" prop="sentTime_display"></el-table-column>

      <el-table-column>
        <template slot-scope="scope">
          <el-button type="primary" @click="visitDetail(scope.row)">查看详情</el-button>
          <!-- <el-button type="danger">???</el-button> -->
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "Info",
  data() {
    return {
      tableData: [],
    };
  },
  methods: {
    init(tableData) {
      for (var i = 0; i < tableData.length; i++) {
        tableData[i].no = i + 1;
        tableData[i].sentTime_display = this.changeDate(tableData[i].sentTime);
        tableData[i].payTime_display = this.changeDate(tableData[i].payTime);
        tableData[i].arrivedTime_display = this.changeDate(tableData[i].arrivedTime);
        tableData[i].finishTime_display = this.changeDate(tableData[i].finishTime);

        //   console.log(tableData[i]);
      }

      //   console.log(tableData);
      this.tableData = tableData;
    },
    visitDetail(order) {
      this.$emit("visitDetail", order);
    },
    changeDate(ori) {
      if (ori == null) return null;

      return ori.substring(0, 10) + " " + ori.substring(11, 19);
    },
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.el-input {
  width: 200px;
}

.tip {
  font-size: 16px;
}

.content {
  font-size: 16px;
}

.bg-purple {
  background: #d3dce6;
}

.bg-purple-light {
  background: #e5e9f2;
}

.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
</style>
